---
layout: "default"
title: "suffix"
description: "Swift documentation for 'suffix': Return a slice, up to maxLength in length, containing the."
keywords: "suffix,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-suffix-s_-sliceable-where-s-index_-bidirectionalindextype_-s-maxlength_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-suffix-s_-sliceable-where-s-index_-bidirectionalindextype_-s-maxlength_-int">func <wbr>suffix&lt;S :<wbr> Sliceable where S.Index : BidirectionalIndexType&gt;(<wbr>_:<wbr> S, maxLength: Int)</a>
        
<div class="comment collapse" id="comment-func-suffix-s_-sliceable-where-s-index_-bidirectionalindextype_-s-maxlength_-int"><div class="p">
    <p>Return a slice, up to <code>maxLength</code> in length, containing the
final elements of <code>s</code>.</p>

<p>If <code>maxLength</code> exceeds <code>count(s)</code>, the result contains all
the elements of <code>s</code>.</p>

<p>Complexity: O(1)+K when <code>S.Index</code> conforms to
<code>RandomAccessIndexType</code> and O(N)+K otherwise, where K is the cost
of slicing <code>s</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func suffix&lt;S : Sliceable where S.Index : BidirectionalIndexType&gt;(s: S, maxLength: Int) -&gt; S.SubSlice</code>
    
    
</div></div>
</div>
